package com.crm.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "stock")
public class StockEntity implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(generator="increment")
	@GenericGenerator(name="increment", strategy = "increment")
	private int id;
	
	@OneToOne
	@JoinColumn(name="part_no")
	private Parts partNo;
	
	@Column(name="description")
	private String description;
	
	@Column(name="qty")
	private int quantity;
	
	@Column(name="purchase_date")
	private Date purchaseDate;
	
	@Column(name="last_used_date")
	private Date lastUsedDate;
	
	

	@Column(name="procured_qty")
	private int procuredQuantity;
	
	@Column(name="sold_qty")
	private int soldQuantity;
	
	@ManyToOne
	@JoinColumn(name="business_id")
	private Business businessId;
	
	public StockEntity(){
		
	}
	public StockEntity(Parts part, String description, int quantity, Date purchaseDate,
			int procuredQuantity, int soldQuantity, Business businessId,Date lastUsedDate) {
		this.partNo=part;
		this.description=description;
		this.quantity=quantity;
		this.purchaseDate=purchaseDate;
		this.procuredQuantity=procuredQuantity;
		this.soldQuantity=soldQuantity;
		this.businessId=businessId;
		this.lastUsedDate=lastUsedDate;
	}
	public StockEntity(int id,Parts partNo,String description,int quantity,Date purchasedDate,
			Date lastUsedDate,int procuredQuantity,int soldQuantity,Business businessId){
		this(partNo,description,quantity,purchasedDate,procuredQuantity,soldQuantity,
				businessId,lastUsedDate);
		this.id=id;
	}
	public Date getPurchaseDate() {
		return purchaseDate;
	}

	public void setPurchaseDate(Date purchaseDate) {
		this.purchaseDate = purchaseDate;
	}

	public Date getLastUsedDate() {
		return lastUsedDate;
	}

	public void setLastUsedDate(Date lastUsedDate) {
		this.lastUsedDate = lastUsedDate;
	}

	public int getProcuredQuantity() {
		return procuredQuantity;
	}

	public void setProcuredQuantity(int procuredQuantity) {
		this.procuredQuantity = procuredQuantity;
	}

	public int getSoldQuantity() {
		return soldQuantity;
	}

	public void setSoldQuantity(int soldQuantity) {
		this.soldQuantity = soldQuantity;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Parts getPartNo() {
		return partNo;
	}

	public void setPartNo(Parts partNo) {
		this.partNo = partNo;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public int getQuantity() {
		return quantity;
	}

	public void setQuantity(int quantity) {
		this.quantity = quantity;
	}

	public Business getBusinessId() {
		return businessId;
	}

	public void setBusinessId(Business businessId) {
		this.businessId = businessId;
	}

	

	
}
